classdef dotsDrawableTargets < dotsDrawable
    % @class dotsDrawableTargets
    % Draw one or multiple target at once.
    %
    % @ingroup drawable
    
    properties (SetObservable = true)
        % an x-coordinate for each target (degrees visual angle, centered)
        x = 0;
        
        % a y-coordinate for each target (degrees visual angle, centered)
        y = 0;
        
        % the size for all targets (degrees visual angle)
        size = 1;
        
        % the color for all targets ([R G B])
        color;
        
        % the shape for all targets (integer: 0 means filled square, 1
        % means filled circle)
        shape = 1;
        
        % whether or not to draw smooth target edges (logical)
        smooth = false;
    end
    
    methods
        % Constructor takes no arguments.
        function self = dotsDrawableTargets
            self = self@dotsDrawable;
            self.color = self.foregroundColor;
        end
        
        % Draw one or more dots at once.
        function draw(self)
            dotsMglSmoothness('polygons', double(self.smooth));
            shapeSize = [self.size(:), self.size(:)];
            switch self.shape
                case 0
                    mglFillRect(self.x, self.y, shapeSize, self.color);
                    
                case 1
                    mglFillOval(self.x, self.y, shapeSize, self.color);
            end
        end
    end
end